package com.wbl.train.business.controller;

import com.wbl.train.business.service.DailyTrainTicketService;
import com.wbl.train.common.business.dto.DailyTrainTicketDto;
import com.wbl.train.common.business.entity.DailyTrainTicketEntity;
import com.wbl.train.common.page.PageVo;
import com.wbl.train.common.result.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author 王博纶
 * @since 2024-02-15
 * @description 会员端的余票信息
 */
@AllArgsConstructor
@Slf4j
@RestController
@RequestMapping("/daily-train-ticket")
@Tag(name = "余票信息控制器类",
        description = "DailyTrainTicketController 余票信息 后端数据接口")
public class DailyTrainTicketController {
    private final DailyTrainTicketService dailyTrainTicketService;

    /**
     * 通过id查询 余票信息
     * @param dailyTrainTicketDto dailyTrainTicketDto
     * @return Result
     */
    @Operation(summary = "通过id查询", description = "通过id查询")
    @GetMapping("/query")
    public R<PageVo<DailyTrainTicketEntity>> getById(DailyTrainTicketDto dailyTrainTicketDto) {
        // 火车车次查询
        log.debug("dailyTrainTicketDto :{}",dailyTrainTicketDto);
        PageVo<DailyTrainTicketEntity> pageVo = dailyTrainTicketService.queryTrainTicket(dailyTrainTicketDto);
        return R.ok("查询成功",pageVo);
    }
}
